﻿<%@ include file="../include/top.jsp"%>
<%@ include file="../include/errorArea.jsp" %>
<link rel="stylesheet" href="${baseURL}/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script language="javascript" type="text/javascript" src="${baseURL}/js/jquery.ztree.all-3.5.min.js">
</script>
<script src="${baseURL}/shop/js/calendar.js"></script>
<SCRIPT type="text/javascript">
	var setting = {
		view: {
			dblClickExpand: false
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onClick: onClick
		}
	};

	//var zNodes = ${treedata}; //后台返回的数据

	function onClick(e,treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		zTree.expandNode(treeNode);

		//叶节点，并且不是第一层节点(第一层节点的pId是null)
		//if(!treeNode.isParent && treeNode.pId!=null){
			nodes = zTree.getSelectedNodes();
			$("#selectedNodeName").attr("value", treeNode.name);
			$("#nodeId").attr("value", treeNode.id);
		//}
	}

	function showMenu() {
		var cityObj = $("#selectedNodeName");
		var cityOffset = $("#selectedNodeName").offset();
		$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

		$("body").bind("mousedown", onBodyDown);
	}
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "selectedNodeName" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}

	$(document).ready(function(){
		
		var tablename=document.getElementById("listTable");
		var li=tablename.getElementsByTagName("tr");
		for (var i=0;i<=li.length;i++){
		if (i%2==0){
		li[i].style.backgroundColor="#f6f6f6";
		}else li[i].style.backgroundColor="#FFFFFF";
		}
	});
	
	function clickSS(){
		document.getElementById("Image8").click(); 
	}
</SCRIPT>

  <form action="${ctx}/companyAdmin/listOrder" method="post" name="searchForm" id="searchForm">
    <input type="hidden" name="p" value="1" />
<div class='adduser'>
	<div class='adduser-left'><div class='adduser-icon'></div><span>接收订单</span></div>
</div>
<div class='querycondition'>
	<div class='condtiontitle'><div class='searchcondition'></div>搜索条件：</div>
	<div class='condtion'>
		<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
		  <tr>
		    <td height="5" colspan="2"></td>
		  </tr>
		
		    <tr>
		      <td height="20" align="left" valign="middle">
		      供货商名称：<select name="supName" id="supName" style="width:100px" onchange="checkBuilding('${ctx}');">
		    			<option value="">全部</option>
		    		<c:forEach var="sup" items="${supplierList}">
			      		<option value="${sup.id}">${sup.supplierName}</option>
			      	</c:forEach>
		    	</select>
		   
		      下单时间：
		                              
		           		<input id="startTime" name="startTime" onclick="calendar.show(this);" value="${formdata.startTime}" type="text" class="sell-textinput-02"><strong>到</strong>
		 				<input id="endTime" name="endTime" onclick="calendar.show(this);" value="${formdata.endTime}" type="text" class="sell-textinput-02">
		                       
		  		订单状态：<select id="status" name="status" style="width:100px">
								<option value="">全部</option>
								<option value="2" ${formdata.status=="2"?"selected":""}>已发货</option>
								<option value="5" ${formdata.status=="5"?"selected":""}>已到达社区服务站</option>
							</select>    
		      </td>
		    </tr>
		    <tr>
		    <td>
		       订单编号：<input name="orderCode" type="text" id="orderCode"
					value="${formdata.orderCode}" size="10"/>    
					配送地址： <input name="address" type="text"
				 id="address" value="${formdata.address}" size="20" />
		    </td>
		    </tr>
		</table>
	</div>
	<div class='condtion'>
		<input name="image" style="display:none" type="image" id="Image8" onmouseover="MM_swapImage('Image8','','${baseURL}/images/button_ss_a.jpg',1)" onmouseout="MM_swapImgRestore()" src="${baseURL}/images/button_ss.jpg"/>
		      &nbsp;&nbsp;&nbsp;&nbsp;
		     <%--  <img src="${baseURL}/images/button_qk.jpg" name="clearButton" id="clearButton" style="cursor:pointer" onclick="clearInput()" onmouseover="MM_swapImage('clearButton','','${baseURL}/images/button_qk_a.jpg',1)" onmouseout="MM_swapImgRestore()"/> --%>
		      
		        <input type='button' value='搜索'  class='button cyan medium' onclick="clickSS();">&nbsp;&nbsp;
				<input type='button' value='清空' class='button cyan medium' onclick="clearInput()">	
				<a class='button cyan medium' onclick="searchForm.action='${ctx}/companyAdmin/exportUser';searchForm.submit();">打印签收单</a>	
	</div>
</div>

  </form>
<script>

function clearInput() {
	document.getElementById("status").options[0].selected=true;
	document.getElementById("startTime").value = "";
	document.getElementById("endTime").value = "";
	document.getElementById("supName").options[0].selected=true;
	document.getElementById("orderCode").value = "";
	document.getElementById("address").value = "";
}

function selectAll(checkAllFlag) {
	var checkArray = document.getElementsByName("chk");
	for (var i = 0; i < checkArray.length; i++) {
		checkArray[i].checked = checkAllFlag;
	}
}
</script>

<c:if test="${empty obj.list}">
<div align="center"><b>没有符合条件的记录。</b></div>
</c:if>
<c:if test="${not empty obj.list}">
<div class='userlist-title'>
	<div class='userlist-title-left'><div class='userlist-title-icon'></div><span>订单列表</span></div>
</div>
<div class='userlist'>
<table width="94%" border="0" align="center" cellpadding="0" cellspacing="1" id="listOutTable">

     <tr align="center" bgcolor="#eeeeee">
		<td class='userlist-td operation' height="25" width="5%"><input type="checkbox" onclick="selectAll(this.checked);"></td>
		<td class='userlist-td operation' width="20%">订单编号</td>		
		<td class='userlist-td operation' width="18%">下单时间</td>
		<td class='userlist-td operation' width="8%">订单金额</td>
		<td class='userlist-td operation' width="20%">配送地址</td>
		<td class='userlist-td operation' width="15%">订单状态</td>
		<td class='userlist-td operation'>操作</td>
	</tr>
	<c:forEach var="row" items="${obj.list}"> 
	<tr align="center">
<td class='userlist-td operation'><input name="chk" type="checkbox" id="chk" value="${row.id}" /></td>
			<td class='userlist-td operation'><a onclick="preCreateComment(${row.id});" href="#" class="ctrlLink">${row.orderCode}</a></td>
				 <td class='userlist-td operation'><fmt:formatDate value="${row.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			<td class='userlist-td operation' style="text-align:right;">${row.totalPrice}元</td>
			<td class='userlist-td operation' style="text-align:left;">${row.address}</td>
			<td class='userlist-td operation'>
				<c:if test="${row.status==0}"><font color="red">待付款</font></c:if>
				<c:if test="${row.status==1}"><font color="red">已付款</font></c:if>
			<c:if test="${row.status==6}"><font color="red">已配货</font></c:if>
				<c:if test="${row.status==2}"><font color="red">已发货</font></c:if>
				<c:if test="${row.status==5}"><font color="red">已到达社区服务站</font></c:if>
				<c:if test="${row.status==4}"><font color="red">已取消</font></c:if>
			<c:if test="${row.status==3}"><font color="#339241">已完成</font></c:if>
			</td>
			<td class='userlist-td operation'>
				<c:if test="${row.status==5}">
				<a href="#" onclick="getById('${ctx}','${row.id}')">[会员收货]</a>
			</c:if>
			<c:if test="${row.status==2}">
				<a href="#" onclick="turnById('${ctx}','${row.id}')">[社区服务站收货]</a>
			</c:if>
			</td>
			</tr> 
                </c:forEach>
        </table>
      
<table>
	<tr>
    <td height="5">
    	<input name="button" type="button" onclick="getByIds('${ctx}');" value="会员批量收货" class='button cyan medium'></td>
    	 <td align="center" height="5">
    	<input name="button" type="button" onclick="turnByIds('${ctx}');" value="服务站批量收货" class='button cyan medium'></td>
    	
  </tr>
	<tr>
	    <td height="25" colspan="2"><%@ include file="../include/listpage.jsp"%>
	    </td>
	  </tr>
</table>
</div>
<script src="${ctx}/js/listProduct.js"></script>
</c:if>
<script type="text/javascript">
function preCreateComment(commentId){
	$.layer({
	    type: 2,
	    maxmin: true,
	    shadeClose: true,
	    title: '订单详情',
	    shade: [0.1,'#fff'],
	    offset: [($(window).height() / 10)+'px',''],
	    area: ['600px', '400px'],
	    iframe: {src: '${ctx}/companyAdmin/buyOrderDetail?orderCode='+commentId}
	}); 
}
</script>
<%@ include file="../include/bottom.jsp"%>